package com.qs.controller;


import com.qs.annotation.OperationLog;
import com.qs.pojo.dto.OperLogDto;
import com.qs.response.Response;
import com.qs.service.IExceLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 异常信息日志记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-01-04
 */
@Slf4j
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/exce/log")
public class ExceLogController {

    private final IExceLogService exceLogService;

    /**
     * 分页获取系统异常
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping("/list/{pageNo}/{pageSize}")
    @OperationLog(operModul = "系统操作管理-查询系统异常",operDesc = "管理员分页获取系统异常")
    public Response list(@PathVariable("pageNo") Integer pageNo,
                         @PathVariable("pageSize") Integer pageSize){
        log.info("分页获取系统异常请求进来了--------------");
        Map<String,Object> map = exceLogService.getExceptionList(pageNo, pageSize);
        return Response.success(map);
    }

    /**
     * 删除系统异常
     * @param
     * @param
     * @param
     * @return
     */
    @DeleteMapping("/remove/{ids}")
    @OperationLog(operModul = "系统操作管理-删除系统异常",operDesc = "管理员删除系统异常")
    public Response delete(@PathVariable List<Integer> ids) {
        log.info("删除系统异常请求进来--------------------");
        exceLogService.removeBatchByIds(ids);
        return Response.success();
    }
}
